package com.yang.designmode.ActionMode.strategy;

public class Client {
        public static void main(String[] args) {
            ShoppingCart cart = new ShoppingCart();

            // 设置支付策略为信用卡支付
            cart.setPaymentStrategy(new CreditCardPayment());
            cart.checkout(100);  // 输出: Paid 100 via Credit Card.

            // 切换为PayPal支付
            cart.setPaymentStrategy(new PayPalPayment());
            cart.checkout(200);  // 输出: Paid 200 via PayPal.
        }
}
